package Third;

public class TimeDepositAccount extends Account{
	
	int month;//时间
	public TimeDepositAccount(String id, double balance, int month, double rate) {
	   super(id,balance,rate);
	   this.month = month;
	
	}
	public double calculate() {
		return Balance*month*(Rate/12);
	}
	public String toString() {
		return "account:"+Id+" balance:"+String.format("%.2f",Balance)+" months:"+month+" interest:"+String.format("%.2f",this.calculate())+" (rate:"+String.format("%.2f",Rate*100)+"%)\n";
	}
}
